
// 导航栏
import React,{Component} from 'react'
import { Icon } from 'antd-mobile'
import {withRouter} from 'react-router-dom'

@withRouter
export default class navbar extends Component{
  constructor(props) {
    super(props)
    this.state = {}
  }

  /**
   * 点击左侧
   */
  onClickLeft=()=>{
    this.props.history.goBack()
  }

  render(){
    let {
      left='',
      title='请取名',
      right=''
    } = this.props
    if(left === 'back'){
      left = <Icon size="lg" type="left"/>
    }
    return(
      <div className="app-header">
        <div className="app-header-ins left" onClick={this.onClickLeft}>{left}</div>
        <div className="app-header-ins title">{title}</div>
        <div className="app-header-ins right">{right}</div>
      </div>
    )
  }
}
